/*
 * Copyright (c) [2019] Zhang Yansen.All rights reserved.
 *
 * t-console is licensed under the Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

export const colors = {
  brightGreen: '#4cc61e',
  green: '#97c510',
  yellowGreen: '#a1a328',
  yellow: '#d7b024',
  orange: '#f27f40',
  red: '#d8624c',
  pink: '#ff69b4',
  blue: '#1081c2',
  violet: '#8a35d9',
  gray: '#606060',
  lightGray: '#9e9e9e',
}

export const alias = {
  success: 'brightGreen',
  important: 'orange',
  warn: 'orange',
  critical: 'red',
  error: 'red',
  informational: 'blue',
  info: 'blue',
  default: 'gray',
  inactive: 'lightGray',
  disable: 'lightGray',
}

export function getColor(color) {
  // 先去 alias 查找
  const ck = alias[color]
  if (ck) {
    return colors[ck]
  }

  // 再去 colors 查询
  const cv = colors[color]
  if (cv) {
    return cv;
  }

  // 否则返回原值
  return color
}
